<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>在线招聘</title>
    <!-- 引入样式文件 -->

    <link rel="stylesheet" href="./css/base.css">
    <link rel="stylesheet" href="css/iconfont.css">
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>

    <style>
        .container .top {
            width: 100%;
            position: fixed;
            z-index: 1000;
            background: #fff;
        }

        .container .main {
            width: 100%;
            /* background: blueviolet; */
            position: relative;
            top: 4rem;
        }

        .items-list .item {
            position: relative;
            width: 100%;
            /* background: orange; */
            padding: 0.3rem 0.63rem;

        }

        .items-list .item .item-right {
            width: 25%;
            position: absolute;
            text-align: center;
            top: 2rem;
            right: 0rem;
            /* background: blue; */
        }

        .item .item-left .item-tite {
            font-size: 1rem;
            font-weight: 600;
            margin-bottom: 0.14rem;
        }


        .item-left .item-desc .type-blue {
            color: #278783;
            font-weight: 600;

        }

        .item .item-left .item-desc {
            margin-bottom: 0.14rem;
        }

        .item .item-left .item-tag {
            margin-bottom: 0.14rem;
        }

        .item .item-left .item-other span {
            font-size: 0.95rem;
        }

        .item .item-content {
            padding-bottom: 0.4rem;
            border-bottom: 1px #ddd solid;
        }

        /* 搜索栏 */
        .search-bar {
            width: 93%;
            background: #F7F8FA;
            margin: 1rem;
            padding: 0.5rem;
        }

        .my-icon-sousuo:before {
            content: "\e618";
            margin-right: 0.3rem;
        }

        .search-bar .searchform .form-control {
            border: none;
            box-shadow: none;
            background: #F7F8FA;
        }

        .searchform .input-group {
            display: flex;
            justify-content: flex-start;
            align-items: center;
        }

        .items-list .item {
            position: relative;
            width: 100%;
            /* background: orange; */
            padding: 0.3rem 0.63rem;

        }

        .items-list .item .item-right {
            width: 25%;
            position: absolute;
            text-align: center;
            top: 2rem;
            right: 0rem;
            /* background: blue; */
        }

        .item .item-left .item-tite {
            font-size: 1.2em;
            font-weight: 600;
            margin-bottom: 0.14rem;
        }


        .item-left .item-desc .type-blue {
            color: #278783;
            font-weight: 600;

        }

        .item .item-left .item-desc {
            margin-bottom: 0.14rem;
        }

        .item .item-left .item-tag {
            margin-bottom: 0.14rem;
        }

        .item .item-left .item-tag span {
            border: 1px #ddd solid;
            padding: 2px;
        }

        .item .item-left .item-other span {
            font-size: 0.95rem;
        }

        .item .item-content {
            padding-bottom: 0.4rem;
            border-bottom: 1px #ddd solid;
        }

        .filter-bar {
            width: 93%;
            display: flex;
            justify-content: center;
        }

        .dropdown .btn {
            background: #fff;
        }

        .dropdown-menu {
            width: 100%;
        }
    </style>
</head>

<body>
    <div class="container">
        <div class="top">
            <!-- 搜索 -->
            <div class="search-bar">
                <div class="searchform">
                    <div class="input-group">
                        <i class="iconfont my-icon-sousuo"></i>
                        <input type="text" name="data" id="input-search" class="form-control" placeholder="请输入岗位关键词">
                    </div>
                </div>
            </div>
        </div>
        <div class="main">
            <div class="items-list" id="item">
                <!-- 每一个卡片 -->
                <div class="item" id="1">
                    <div class="item-content">
                        <div class="item-left">
                            <p class="item-tite">招聘岗位&nbsp;:&nbsp;cto</p>
                            <p class="item-desc"><span class="type-blue">30000~40000</span>元/月</p>
                            <p class="item-tag">
                                <span>北京市</span>
                                <span> 博士以上学历</span>
                            </p>
                            <p class="item-other"><span
                                    style="margin-right: 1rem;">hr&nbsp;:&nbsp;高经理-人事部123</span><span>招聘总数&nbsp;:&nbsp;2</span>
                            </p>
                        </div>
                        <div class="item-right">
                            <p class="item-values">0/5</p>
                            <p calss="item-name">投递数</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>

</body>
<script>
    var data = [
        {
            list: [
                { id: '1', job: 'name1', salary: 'cont1' , site:'北京', edu:'本科',hr:'高经理-人事部',recruit:'2',delivery:'0/3'}
            ]
        }
    ]
    $('#input-search').on('keyup', function (e) {
        console.log("e:",e)
        if (e.keyCode === 13) {
            var res = data[0].list;//ajax请求
            console.log("res", res)
            var html = '';
            res.forEach(element => {
                html += ['<div class="items-list" id="item">',
                    '<div class="item" id="' + element.id + '">',
                    '<div class="item-content">',
                    '<div class="item-left">',
                    '<p class="item-tite">招聘岗位&nbsp;:&nbsp;' + element.job + '</p>',
                    '<p class="item-desc"><span class="type-blue">' + element.salary + '</span>元/月</p>',
                    '<p class="item-tag">',
                    '<span>' + element.site + '</span>',
                    '<span>' + element.edu + '</span>',
                    '</p>',
                    '<p class="item-other"><span style="margin-right: 1rem;">hr&nbsp;:&nbsp;' + element.hr + '</span><span>招聘总数&nbsp;:&nbsp;' + element.recruit + '</span>',
                    '</p>',
                    '</div>',
                    '<div class="item-right">',
                    '<p class="item-values">'+element.delivery+'</p>',
                    '<p calss="item-name">投递数</p>',
                    '</div></div></div></div>'
                ].join('');
            });
            $('#item').html(html);
            console.log('按下回车，请求数据', this.value)
        }
    })
    $("#1").click(function () {
        $(location).attr('href', 'http://www.baidu.com');
    });
</script>

</html>